# Maintainer: Caleb Maclennan <caleb@alerque.com>
# Contributor: David Flemström <david.flemstrom@gmail.com>

pkgname=rq
pkgver=1.0.4
pkgrel=1
pkgdesc='Record Query, a tool for record analysis and transformation'
arch=(loong64 x86_64)
url="https://github.com/dflemstr/$pkgname"
license=(Apache)
depends=(gcc-libs)
makedepends=(cargo)
_archive="$pkgname-$pkgver"
options=(!lto)
source=("$url/archive/v$pkgver/$_archive.tar.gz")
sha256sums=('4c3fc4427d02271c93a2cf4a784887982e97f9aba4946900aad1a35b142f9a47')

prepare() {
	cd "$_archive"
	cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}

build() {
	cd "$_archive"
	cargo build --frozen --release --all-features
}

check() {
	cd "$_archive"
	cargo test --frozen --all-features
}

package() {
	cd "$_archive"
	install -Dm0755 -t "$pkgdir/usr/bin/" "target/release/$pkgname"
	install -Dm0644 -t "$pkgdir/usr/share/licenses/$pkgname/" LICENSE
}
